/***************************************************************************
 *   Copyright (C) 2007 by gaojian   *
 *   781102@vip.sina.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef DICTIONARYDICTIONARY_H
#define DICTIONARYDICTIONARY_H
class QString ;
class QBuffer;
#include <qobject.h>

#include <kio/job.h>

/**
	@author gaojian <gaojian2008cnn@vip.sina.com>
*/
class Dictionary : public QObject
{
  Q_OBJECT
public:
    Dictionary(QObject *parent = 0, const char *name = 0);
    ~Dictionary();
    void search(const QString& text);
    static bool netcomOrTelecom;//标记是网通（netcom）还是电信（telecom）线路 ,网通为true电信为false
private:
    void searchENWord(const QString &word);//搜索英文单词
    void searchCNWord(const QString &word);//搜索中文和数字
    QString getFlashHtml(const QString& word);
    QString getWordBookHtml(const QString& word);
    QString targetWord;
private:
    QBuffer *buffer;//kio区回数据的缓冲
     
private slots:
    void slotENResult(KIO::Job *job);//处理查找英文单词的返回结果
    void slotCHResult(KIO::Job *job);//处理查 中文和数字的返回结果
    void slotBufferData(KIO::Job *job, const QByteArray &data);//kio区回数据的缓冲
signals:
    void searchResult(const QString&);//发出处理后的html最终代码
    void searchError(const QString&);//发出错误信号
};

#endif
